Initialize subroutine
'
'
' ***** Initialize ****
'
SUB Initialize
  XuiGetDefaultGridFunctions (@func[])
  XgrMessageNameToNumber (@"LastMessage", @upperSub)
'
  func[#GetSmallestSize] = 0 ' cancel default standard message function
  func[#Resize] = 0 ' cancel default standard message function
'
  DIM sub[upperSub]
  sub[#Callback] = SUBADDRESS (Callback)
  sub[#Create] = SUBADDRESS (Create)
  sub[#CreateWindow] = SUBADDRESS (CreateWindow)
  sub[#GetSmallestSize] = SUBADDRESS (GetSmallestSize)
  sub[#Resize] = SUBADDRESS (Resize)
  sub[#Selection] = SUBADDRESS (Selection)
'
  IF func[0] THEN PRINT "XuiDialog2B() : Initialize : error ::: (undefined message)"
  IF sub[0] THEN PRINT "XuiDialog2B() : Initialize : error ::: (undefined message)"
  XuiRegisterGridType (@XuiDialog2B, @"XuiDialog2B", &XuiDialog2B(), @func[], @sub[])
'
  designX = 0
  designY = 0
  designWidth = 160
  designHeight = 68
'
  gridType = XuiDialog2B
  XuiSetGridTypeValue (gridType, @"xWin", designX)
  XuiSetGridTypeValue (gridType, @"yWin", designY)
  XuiSetGridTypeValue (gridType, @"width", designWidth)
  XuiSetGridTypeValue (gridType, @"height", designHeight)
  XuiSetGridTypeValue (gridType, @"minWidth", 64)
  XuiSetGridTypeValue (gridType, @"minHeight", 24)
' XuiSetGridTypeValue (gridType, @"minWidth", designWidth)
' XuiSetGridTypeValue (gridType, @"minHeight", designHeight)
' XuiSetGridTypeValue (gridType, @"maxWidth", designWidth)
' XuiSetGridTypeValue (gridType, @"maxHeight", designHeight)
  XuiSetGridTypeValue (gridType, @"border", $$BorderFrame)
  XuiSetGridTypeValue (gridType, @"can", $$Focus OR $$Respond)
  XuiSetGridTypeValue (gridType, @"focusKid", $TextLine)
  XuiSetGridTypeValue (gridType, @"inputTextString", $TextLine)
  XuiSetGridTypeValue (gridType, @"redrawFlags", $$RedrawBorder)
IFZ message THEN RETURN
END SUB
END FUNCTION

The Initialize subroutine is executed only once - the first time the grid function is called.  It establishes the initial or default appearance and behavior of every grid of a grid type by setting its:

  default message processing functions
  default message processing subroutines
  default properties

When a grid is created, it is given the default values of its grid type.  After a grid is created, programs can send any number of messages to a grid to change its properties, message processing functions, and message processing subroutines.

Programs often send a few messages to a grid to change properties like grid name, help string, or color.  Most programs should rarely if ever change a message processing function or subroutine, however.